{% extends 'common/basic_list.html' %}

{% block list_title %}
    机房
{% endblock %}

{% block list_filter %}
    <div class="col-sm-2">
        <select class="form-control m-b" name="operator">
            <option value="" {% ifequal '' operator %}
                    selected="selected"
            {% endifequal %}
            >ISP类型
            </option>
            {% for o in isp_type %}
                <option value="{{ o.id }}" {% ifequal o.id operator|str_to_int %}
                        selected="selected"
                {% endifequal %}

                >{{ o.name }}</option>
            {% endfor %}
        </select>
    </div>
    <div class="col-sm-4">
        <div class="input-group">
            <button type="submit" class="btn btn-sm btn-primary"><i class="fa fa-search"></i> 搜索</button>
            &nbsp;
            <a href="idc_add/"
               class="btn btn-sm btn-success"><i class="fa fa-plus"></i> 新增</a>
            &nbsp;
            <a href="javascript:void(0)"
               onclick="deleteBatch()"
               class="btn btn-sm btn-danger"><i class="fa fa-trash"></i> 批量删除</a>
        </div>
    </div>
{% endblock %}

{% block list_content %}
    <table class="table table-striped table-bordered table-hover dataTables-example dataTable">
        <thead>
        <tr>
            <th style="width: 3%"><input id="checkall" type="checkbox" class="i-checks"></th>
            <th style="width: 7%;">机房名称</th>
            <th style="width: 7%;">机房类型</th>
            <th style="width: 7%;">联系电话</th>
            <th style="width: 7%;">联系人</th>
            <th style="width: 7%;">机房地址</th>
            <th style="width: 7%;">ISP类型</th>
            <th style="width: 7%;">联系邮箱</th>
            <th style="width: 7%;">机柜数量</th>
            <th style="width: 7%;">创建时间</th>
            <th style="width: 7%;">更新时间</th>
            <th style="width:15%;">操作</th>
        </tr>
        </thead>
        <tbody>
        {% for o in result_list %}
            <tr>
                <td>
                    <input type="checkbox" class="i-checks icheck" id="{{ o.id }}" name="input[]">
                </td>
                <td>{{ o.name }}</td>
                <td>{{ o.type }}</td>
                <td>{{ o.phone }}</td>
                <td>{{ o.linkman }}</td>
                <td>{{ o.address }}</td>
                <td>{{ o.operator }}</td>
                <td>{{ o.concat_email }}</td>
                <td>{{ o.id|cabinet_count }}</td>
                <td>{{ o.create_time }}</td>
                <td>{{ o.update_time }}</td>
                <td>
                    <a href="{{ o.id }}/idc_edit/"
                       class="btn  btn-sm btn-info"><i class="fa fa-edit"></i>编辑</a>
                    <a href="javascript:void(0)"
                       onclick="deleteAction('{{ o.id }}')"
                       class="btn  btn-sm btn-danger"><i class="fa fa-trash"></i>删除</a>
                </td>
            </tr>
        {% endfor %}
        </tbody>
    </table>
{% endblock %}